home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / ecstr1.arc / STRCAT.C < prev    next >
C/C++ Source or Header  |  1987-03-04  |  759b  |  28 lines

  1. /*  File   : strcat.c
  2.     Author : Richard A. O'Keefe.
  3.     Updated: 10 April 1984
  4.     Defines: strcat()
  5.  
  6.     strcat(s, t) concatenates t on the end of s.  There  had  better  be
  7.     enough  room  in  the  space s points to; strcat has no way to tell.
  8.     Note that strcat has to search for the end of s, so if you are doing
  9.     a lot of concatenating it may be better to use strmov, e.g.
  10.        strmov(strmov(strmov(strmov(s,a),b),c),d)
  11.     rather than
  12.        strcat(strcat(strcat(strcpy(s,a),b),c),d).
  13.     strcat returns the old value of s.
  14. */
  15.  
  16. #include "strings.h"
  17.  
  18. char *strcat(s, t)
  19.     register char *s, *t;
  20.     {
  21.        char *save;
  22.  
  23.        for (save = s; *s++; ) ;
  24.        for (--s; *s++ = *t++; ) ;
  25.        return save;
  26.     }
  27.  
  28.